import axios from "axios"
import { getItem } from "@/helpers/persistanceStorage"

// axios.defaults.baseURL = "https://conduit.productionready.io/api"

axios.defaults.baseURL = process.env.VUE_APP_BASE_API
axios.interceptors.request.use((config) => {
  const token = getItem("accessToken")
  const authorizationToken = token ? `Bearer ${token}` : ""
  config.headers.Authorization = authorizationToken
  return config
})

export default axios
